﻿using Abp.Dependency;
using Abp.Domain.Uow;
using Abp.Threading.BackgroundWorkers;
using Abp.Threading.Timers;
using SingleUserMall.Orders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SingleUserMall.Works
{
    public class BackgroundWorker : PeriodicBackgroundWorkerBase, ISingletonDependency
    {
        public OrderManager OrderManager { get; set; }
        private readonly static object lockobj = new object();
        public BackgroundWorker(AbpTimer timer) : base(timer)
        {
            timer.Period = 300000;
        }

        [UnitOfWork(false)]
        protected override void DoWork()
        {
            lock (lockobj)
            {
                //执行后台任务
                OrderManager.QueryWork();
            }
        }
    }
}
